/*
Problem Id:2677  User Id:Latex 
Memory:528K  Time:0MS
Language:G++  Result:Accepted

Source 
*/
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>

	const int MAXN = 1010;
	const double e = 1e-8;
	double f[MAXN][MAXN];
	double point[MAXN][2];
	double	g[MAXN][MAXN];
	int n;
	
double dist(double ax, double ay, double bx, double by)
{
	return sqrt ((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
}

int max(int a, int b)
{
	if (a > b) return a;
	else return b;
}

main()
{
	int	i, j, k;
	double best;
	
	
	while (scanf("%d", &n)!=EOF)
	{
		for (i=1; i<=n; i++)
			scanf("%lf%lf", &(point[i][0]), &(point[i][1]));
		for (i=1; i<=n; i++)
		{
			g[i][i] = 0;
			for (j=i+1; j<=n; j++)
				g[i][j] = g[j][i] = dist(point[i][0], point[i][1], point[j][0], point[j][1]);
		}
		for (i=1; i<=n; i++)
			for (j=1; j<=n; j++)
				f[i][j] = -1;
		
		f[1][1] = 0;
		for (i=1; i<=n; i++)
			for (j=1; j<=n; j++)
				if (f[i][j] > -e)
				{
					k = max(i, j) + 1;
					//debug 
//					printf("i = %ld, j = %ld\n", i, j);
					
					if (k<=n)
					{
						if (f[k][j] < 0 || f[i][j] + g[i][k] < f[k][j] + e)
							f[k][j] = f[i][j] + g[i][k];
						if (f[i][k] < 0 || f[i][j] + g[j][k] < f[i][k] + e)
							f[i][k] = f[i][j] + g[j][k];
					}
				}
		//debug		
		//printf("debug : n= %ld\n", n);

		for (i=1; i<n; i++)
			{
				if (f[n][n] < 0 || f[i][n] + g[i][n] < f[n][n] + e)
					f[n][n] = f[i][n] + g[i][n];
				if (f[n][n] < 0 || f[n][i] + g[i][n] < f[n][n] + e)
					f[n][n] = f[n][i] + g[i][n];
			}

		printf("%0.2lf\n", f[n][n]);
	}
	
	return 0;
}


